home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2003 November A / PCWK1103A.iso / ABBYY FineReader 7.0 PRO / data1.cab / gs_icc.ps < prev    next >
Text File  |  2002-02-23  |  4KB  |  115 lines

  1. %    Copyright (C) 2001 Aladdin Enterprises.  All rights reserved.
  2. % This software is provided AS-IS with no warranty, either express or
  3. % implied.
  4. % This software is distributed under license and may not be copied,
  5. % modified or distributed except as expressly authorized under the terms
  6. % of the license contained in the file LICENSE in this distribution.
  7. % For more information about licensing, please refer to
  8. % http://www.ghostscript.com/licensing/. For information on
  9. % commercial licensing, go to http://www.artifex.com/licensing/ or
  10. % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. % San Rafael, CA  94903, U.S.A., +1(415)492-9861.
  12.  
  13. % $Id: gs_icc.ps,v 1.2.2.1 2002/02/22 19:45:55 ray Exp $
  14. % PostScript portion of ICCBased color space support
  15.  
  16. //userdict /.icc_comp_map_dict
  17.   << 1 /DeviceGray  3 /DeviceRGB  4 /DeviceCMYK >>
  18. put
  19.  
  20. colorspacedict /ICCBased
  21.   {
  22.     % Verify that the source object is an array, that it is at least of length
  23.     % two, and that the second entry is a readable dictionary. If we got this
  24.     % far, we know the top-level object exists and is readable, but it might
  25.     % be a dictionary.
  26.     dup type dup /arraytype ne exch /packedarraytype ne and
  27.       { /setcolorspace /typecheck signalerror }
  28.     if
  29.     dup length 2 lt
  30.       { /setcolorspace /rangecheck signalerror }
  31.     if
  32.     dup 1 get type /dicttype ne
  33.       { /setcolorspace /typecheck signalerror }
  34.     if
  35.     dup 1 get rcheck not
  36.       { /setcolorspace /invalidaccess signalerror }
  37.     if
  38.  
  39.     % Verify that the dictionary defines the key N (number of components) and
  40.     %  entry is provided and has a legitimate value
  41.     dup 1 get /N .knownget
  42.       {
  43.         //.icc_comp_map_dict exch known not
  44.           { 
  45.             % generate the appropriate error
  46.             /setcolorspace 
  47.             1 index 1 get /N type type /integertype ne
  48.               { /typecheck }
  49.               { /rangecheck }
  50.             ifelse
  51.             signalerror
  52.           }
  53.         if
  54.       }
  55.       { /setcolorspace /undefined signalerror }
  56.     ifelse
  57.  
  58.     % Verify DataSrouce and, if it is a string, convert it to a file
  59.     dup 1 get /DataSource .knownget
  60.       {
  61.         dup rcheck not
  62.           { pop /setcolorspace /invalidaccess signalerror }
  63.         if
  64.         type dup /stringtype eq
  65.           {
  66.             pop
  67.             2 array copy
  68.             dup 1
  69.              2 copy get dup length dict copy
  70.              dup /DataSource
  71.               2 copy get /ReusableStreamDecode filter
  72.              put
  73.             put
  74.           }
  75.           {
  76.             /filetype ne
  77.               { /setcolorspace /typecheck signalerror }
  78.             if
  79.           }
  80.         ifelse
  81.       }
  82.       { /setcolorspace /undefined signalerror }
  83.     ifelse
  84.  
  85.     % set the alternate color space to be the current color space
  86.     dup 1 get /Alternate .knownget not
  87.       { dup 1 get /N get //.icc_comp_map_dict exch get }
  88.     if
  89.     setcolorspace
  90.  
  91.     % if CIE spaces are not use, just take the alternate space
  92.     NOCIE
  93.       { pop //null }
  94.       { % check for native support
  95.         /.seticcspace where
  96.           { pop dup 1 get
  97.         % Acrobat Reader silently ignores errors with ICC profiles
  98.         % and uses the alternate color space -- do the same.
  99.         mark exch { .seticcspace } stopped
  100.           { cleartomark pop //null }
  101.           { pop }
  102.         ifelse
  103.       }
  104.           { pop //null }
  105.         ifelse
  106.       }
  107.     ifelse
  108.   }
  109. bind put
  110.  
  111. //userdict /.icc_comp_map_dict undef
  112.